import pod
import pod.set

class Person(pod.Object):                                                # Any instances created by a class that descends from pod.Object 
    pass                                                                 # will be stored to last opened database connection.    

class Tycoon(Person):                                                    # Now, add a class Tycoon that descends from Person . . . 

     def __init__(self, **kwargs):
        
         pod.Object.__init__(self, **kwargs)                                          
        
         self.yachts  = []                                               # Also note, attributes can be of any type that can be pickled
         self.villas  = {}                                               # including lists, sets, and dictionaries. Note, these are native
                                                                         # Python collections and are not scalable. 
         
         self.workers = pod.set.Set()                                    # If you want a scalable collection implemented using SQL, use the 
                                                                         # pod.List, pod.Dict, or pod.Set collection objects. 
                  
class WorkerBee(Person):
    
    def __init__(self, boss, **kwargs):
        Person.__init__(self, **kwargs)     
        self.boss = boss                                                 # Also, native Python and pod collections often remove the need for 
        self.boss.workers.add(self)                                      # one-to-many or many-many relational tables for small data sets. 
                                                              
    
    def pre_delete(self):                                                # In pod, nothing is done 'automatically' for you.  You have to 
        self.boss.workers.remove(self)                                   # take care of cleanup yourself
